package Test3;

import java.util.ArrayList;

public class Student_test {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        list.add(new Student("李白", 23, "男"));
        list.add(new Student("李清照", 21, "女"));
        list.add(new Student("白居易", 24, "男"));
        for (Student student : list) {
            System.out.println(student);
        }
        int geMaxAge = 0;
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getAge() > geMaxAge) {
                geMaxAge = i;

            }

        }
        System.out.println("===============");
        list.get(geMaxAge).setName("小猪佩奇");
        for (Student student : list) {
            System.out.println(student);

        }
    }
}
